package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author rui
 * @since 2024-07-25
 */
@RestController
@RequestMapping("/likes")
@Api(tags = "点赞相关接口")
@RequiredArgsConstructor
public class LikedRecordController {
    private final ILikedRecordService recordService;
    @ApiOperation("进行点赞或取消点赞")
    @PostMapping()
    public void addLikedRecord(@RequestBody @Validated LikeRecordFormDTO dto){
        recordService.addLikedRecord(dto);
    }

    @ApiOperation("查询当前用户是否点赞了指定业务")
    @GetMapping("/list")
    public Set<Long> likedQueryByBizIds(@RequestParam("bizIds") List<Long> bizIds){
        return recordService.likedQueryByBizIds(bizIds);
    }

}
